From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0001.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0001.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0002.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0002.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0003.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0003.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment.html From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0004.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0004.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0001.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment.html From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0005.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0005.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0002.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0001.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0001.html From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0007.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0007.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0004.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0003.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0002.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment.html From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0008.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0008.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0005.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0004.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0003.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0001.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0009.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0009.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0006.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0005.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0004.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0002.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0001.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0010.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0010.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0007.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0006.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0005.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0003.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0002.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0001.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0001.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0011.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0011.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0008.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0007.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0006.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0004.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0003.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0002.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0002.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0012.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0012.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0009.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0008.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0007.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0005.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0004.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0003.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0003.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0013.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0013.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0010.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0009.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0008.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0006.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0005.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0004.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0004.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment.pl From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0014.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0014.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0011.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0010.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0009.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0008.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0007.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0006.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0006.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0001.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0015.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0015.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0012.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0011.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0010.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0009.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0008.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0007.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0007.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0002.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0016.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0016.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0013.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0012.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0011.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0010.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0009.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0008.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0008.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0003.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0017.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0017.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0014.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0013.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0012.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0011.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0010.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0009.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0009.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0004.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0018.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0018.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0015.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0014.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0013.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0012.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0011.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0010.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0010.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0005.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0019.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0019.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0016.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0015.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0014.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0013.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0012.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0011.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0011.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0006.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0020.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0020.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0017.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0016.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0015.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0014.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0013.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0012.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0012.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0007.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0021.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0021.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0018.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0017.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0016.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0015.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0014.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0013.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0013.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0008.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0022.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0022.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0019.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0018.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0017.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0016.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0015.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0014.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0014.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0009.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0023.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0023.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0020.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0019.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0018.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0017.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0016.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0015.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0015.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0010.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0024.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0024.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0021.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0020.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0019.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0018.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0017.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0016.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0016.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0011.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0025.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0025.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0022.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0021.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0020.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0019.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0018.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0017.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0017.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0012.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0026.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0026.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0023.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0022.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0021.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0020.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0019.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0018.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0018.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0013.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0027.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0027.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0024.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0023.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0022.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0021.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0020.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0019.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0019.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0014.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0028.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0028.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0025.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0024.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0023.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0022.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0021.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0020.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0020.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0015.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0029.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0029.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0026.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0025.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0024.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0023.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0022.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0021.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0021.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0016.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0030.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0030.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0027.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0026.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0025.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0024.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0023.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0022.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0022.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0017.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0031.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0031.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0028.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0027.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0026.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0025.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0024.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0023.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0023.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0018.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0032.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0032.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0029.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0028.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0027.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0026.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0025.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0024.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0024.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0019.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0033.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0033.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0030.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0029.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0028.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0027.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0026.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0025.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0025.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0020.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0034.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0034.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0031.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0030.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0029.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0028.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0027.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0026.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0026.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0021.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0035.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0035.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0032.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0031.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0030.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0029.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0028.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0027.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0027.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0022.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0036.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0036.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0033.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0032.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0031.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0030.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0029.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0028.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0028.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0023.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0037.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0037.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0034.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0033.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0032.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0031.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0030.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0029.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0029.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0024.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0038.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0038.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0035.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0034.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0033.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0032.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0031.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0030.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0030.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0025.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0039.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0039.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0036.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0035.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0034.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0033.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0032.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0031.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0031.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0026.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0040.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0040.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0037.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0036.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0035.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0034.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0033.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0032.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0032.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0027.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0041.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0041.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0038.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0037.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0036.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0035.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0034.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0033.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0033.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0028.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0042.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0042.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0039.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0038.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0037.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0036.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0035.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0034.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0034.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0029.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0043.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0043.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0040.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0039.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0038.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0037.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0036.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0035.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0035.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0030.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0044.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0044.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0041.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0040.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0039.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0038.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0037.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0036.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0036.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0031.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0045.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0045.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0042.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0041.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0040.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0039.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0038.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0037.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0037.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0032.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0046.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0046.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0043.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0042.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0041.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0040.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0039.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0038.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0038.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0033.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0047.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0047.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0044.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0043.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0042.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0041.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0040.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0039.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0039.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0034.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0048.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0048.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0045.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0044.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0043.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0042.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0041.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0040.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0040.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0035.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0049.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0049.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0046.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0045.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0044.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0043.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0042.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0041.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0041.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0036.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0050.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0050.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0047.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0046.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0045.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0044.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0043.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0042.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0042.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0037.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0051.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0051.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0048.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0047.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0046.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0045.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0044.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0043.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0043.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0038.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0052.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0052.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0049.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0048.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0047.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0046.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0045.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0044.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0044.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0039.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0053.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0053.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0050.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0049.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0048.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0047.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0046.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0045.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0045.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0040.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0054.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0054.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0051.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0050.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0049.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0048.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0047.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0046.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0046.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0041.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0055.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0055.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0052.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0051.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0050.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0049.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0048.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0047.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0047.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0042.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0056.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0056.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0053.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0052.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0051.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0050.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0049.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0048.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0048.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0043.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0057.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0057.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0054.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0053.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0052.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0051.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0050.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0049.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0049.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0044.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0058.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0058.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0055.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0054.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0053.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0052.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0051.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0050.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0050.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0045.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0059.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0059.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0056.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0055.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0054.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0053.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0052.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0051.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0051.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0046.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0060.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0060.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0057.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0056.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0055.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0054.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0053.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0052.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0052.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0047.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0061.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0061.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0058.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0057.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0056.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0055.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0054.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0053.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0053.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0048.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0062.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0062.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0059.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0058.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0057.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0056.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0055.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0054.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0054.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0049.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0063.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0063.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0060.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0059.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0058.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0057.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0056.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0055.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0055.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0050.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0064.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0064.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0061.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0060.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0059.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0058.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0057.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0056.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0056.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0051.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0065.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0065.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0062.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0061.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0060.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0059.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0058.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0057.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0057.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0052.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0066.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0066.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0063.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0062.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0061.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0060.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0059.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0058.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0058.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0053.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0067.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0067.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0064.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0063.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0062.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0061.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0060.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0059.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0059.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0054.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0068.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0068.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0065.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0064.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0063.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0062.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0061.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0060.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0060.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0055.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0069.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0069.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0066.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0065.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0064.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0063.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0062.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0061.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0061.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0056.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0070.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0070.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0067.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0066.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0065.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0064.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0063.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0062.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0062.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0057.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0071.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0071.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0068.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0067.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0066.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0065.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0064.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0063.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0063.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0058.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0072.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0072.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0069.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0068.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0067.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0066.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0065.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0064.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0064.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0059.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0073.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0073.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0070.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0069.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0068.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0067.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0066.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0065.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0065.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0060.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0074.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0074.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0071.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0070.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0069.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0068.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0067.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0066.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0066.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0061.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0075.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0075.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0072.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0071.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0070.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0069.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0068.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0067.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0067.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0062.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0076.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0076.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0073.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0072.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0071.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0070.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0069.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0068.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0068.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0063.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0077.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0077.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0074.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0073.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0072.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0071.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0070.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0069.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0069.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0064.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0078.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0078.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0075.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0074.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0073.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0072.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0071.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0070.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0070.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0065.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0079.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0079.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0076.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0075.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0074.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0073.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0072.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0071.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0071.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0066.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0080.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0080.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0077.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0076.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0075.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0074.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0073.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0072.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0072.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0067.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0081.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0081.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0078.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0077.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0076.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0075.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0074.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0073.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0073.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0068.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0082.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0082.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0079.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0078.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0077.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0076.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0075.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0074.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0074.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0069.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0083.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0083.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0080.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0079.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0078.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0077.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0076.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0075.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0075.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0070.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0084.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0084.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0081.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0080.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0079.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0078.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0077.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0076.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0076.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0071.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0085.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0085.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0082.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0081.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0080.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0079.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0078.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0077.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0077.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0072.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0086.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0086.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0083.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0082.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0081.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0080.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0079.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0078.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0078.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0073.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0087.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0087.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0084.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0083.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0082.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0081.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0080.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0079.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0079.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0074.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0088.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0088.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0085.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0084.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0083.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0082.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0081.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0080.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0080.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0075.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0089.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0089.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0086.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0085.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0084.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0083.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0082.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0081.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0081.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0076.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0090.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0090.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0087.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0086.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0085.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0084.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0083.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0082.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0082.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0077.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0091.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0091.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0088.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0087.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0086.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0085.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0084.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0083.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0083.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0078.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0092.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0092.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0089.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0088.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0087.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0086.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0085.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0084.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0084.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0079.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0093.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0093.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0090.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0089.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0088.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0087.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0086.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0085.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0085.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0080.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0094.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0094.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0091.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0090.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0089.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0088.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0087.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0086.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0086.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0081.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0095.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0095.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0092.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0091.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0090.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0089.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0088.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0087.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0087.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0082.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0096.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0096.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0093.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0092.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0091.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0090.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0089.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0088.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0088.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0083.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0097.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0097.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0094.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0093.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0092.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0091.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0090.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0089.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0089.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0084.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0098.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0098.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0095.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0094.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0093.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0092.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0091.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0090.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0090.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0085.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0099.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0099.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0096.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0095.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0094.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0093.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0092.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0091.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0091.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0086.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0100.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0100.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0097.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0096.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0095.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0094.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0093.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0092.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0092.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0087.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0101.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0101.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0098.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0097.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0096.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0095.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0094.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0093.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0093.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0088.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0102.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0102.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0099.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0098.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0097.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0096.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0095.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0094.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0094.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0089.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0103.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0103.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0100.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0099.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0098.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0097.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0096.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0095.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0095.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0090.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0104.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0104.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0101.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0100.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0099.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0098.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0097.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0096.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0096.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0091.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0105.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0105.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0102.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0101.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0100.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0099.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0098.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0097.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0097.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0092.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0106.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0106.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0103.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0102.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0101.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0100.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0099.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0098.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0098.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0093.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0107.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0107.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0104.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0103.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0102.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0101.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0100.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0099.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0099.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0094.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0108.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0108.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0105.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0104.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0103.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0102.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0101.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0100.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0100.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0095.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0109.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0109.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0106.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0105.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0104.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0103.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0102.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0101.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0101.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0096.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0110.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0110.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0107.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0106.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0105.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0104.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0103.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0102.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0102.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0097.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0111.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0111.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0108.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0107.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0106.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0105.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0104.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0103.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0103.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0098.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0112.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0112.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0109.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0108.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0107.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0106.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0105.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0104.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0104.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0099.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0113.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0113.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0110.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0109.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0108.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0107.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0106.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0105.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0105.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0100.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0114.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0114.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0111.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0110.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0109.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0108.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0107.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0106.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0106.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0101.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0115.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0115.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0112.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0111.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0110.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0109.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0108.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0107.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0107.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0102.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0116.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0116.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0113.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0112.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0111.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0110.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0109.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0108.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0108.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0103.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0117.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0117.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0114.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0113.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0112.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0111.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0110.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0109.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0109.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0104.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0118.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0118.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0115.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0114.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0113.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0112.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0111.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0110.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0110.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0105.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0119.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0119.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0116.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0115.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0114.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0113.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0112.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0111.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0111.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0106.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0120.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0120.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0117.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0116.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0115.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0114.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0113.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0112.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0112.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0107.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0121.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0121.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0118.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0117.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0116.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0115.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0114.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0113.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0113.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0108.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0122.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0122.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0119.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0118.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0117.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0116.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0115.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0114.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0114.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0109.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0123.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0123.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0120.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0119.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0118.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0117.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0116.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0115.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0115.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0110.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0124.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0124.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0121.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0120.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0119.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0118.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0117.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0116.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0116.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0111.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0125.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0125.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0122.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0121.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0120.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0119.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0118.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0117.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0117.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0112.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0126.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0126.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0123.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0122.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0121.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0120.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0119.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0118.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0118.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0113.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0127.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0127.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0124.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0123.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0122.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0121.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0120.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0119.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0119.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0114.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0128.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0128.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0125.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0124.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0123.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0122.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0121.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0120.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0120.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0115.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0129.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0129.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0126.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0125.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0124.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0123.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0122.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0121.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0121.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0116.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0130.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0130.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0127.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0126.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0125.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0124.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0123.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0122.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0122.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0117.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0131.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0131.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0128.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0127.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0126.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0125.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0124.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0123.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0123.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0118.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0132.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0132.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0129.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0128.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0127.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0126.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0125.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0124.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0124.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0119.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0133.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0133.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0130.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0129.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0128.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0127.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0126.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0125.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0125.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0120.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test code i'm using to do the tests: > > public static void main(String args[]) { > try { > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier("COM1"); > RXTXPort serialPort = (RXTXPort) portId.open("yaya", 50); > serialPort.setSerialPortParams(115200, > SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); > serialPort.enableReceiveTimeout(180000); > long t = System.currentTimeMillis(); > int resp = serialPort.getInputStream().read(); > t = System.currentTimeMillis() - t; > System.err.println(t + " " + resp); > serialPort.close(); > } catch(Exception ex) { > ex.printStackTrace(); > } > } > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > . > From Steffen.DETTMER at ingenico.com Thu Oct 2 05:36:37 2008 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Thu, 2 Oct 2008 13:36:37 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48E49018.3050908@gmail.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> Message-ID: <20081002113637.GB25437@elberon.bln.de.ingenico.com> Hi, * marcopar at gmail.com wrote on Thu, Oct 02, 2008 at 11:10 +0200: > So? Is it a normal behavior? Is it a bug? Is it a known issue but can't > be solved? Maybe i did something wrong? Suggestions? I don't know if the results we had in some old version (rxtx-2.1-7-bins-r2) are related or not, so just in case. In our project we found the timeout precision beeing bad. We have a wrapper implementation around offering a read with timeout and intercharacter timeout which ended up beeing quite complex. Essentially, read is called with some remaining timeout set by some setReceiveTimeout() method. Since we found that sometimes the duration was much longer than the timeout passed, I modified setReceiveTimeout() to set a value a bit smaller (first we assumed rounding problems by the modulo 100) and finally to use half the specified value because the timeout handling in the native code doesn't adjust its internal c_cc[VTIME] value (IMHO a bug). So when a timeout of 10 sec is required, first 5 are set, then 2500ms, 1225ms etc. This made the implementation fulfill our requirements (we needed better than 200 ms precision). The following copy&paste comments and snipped explains this (but probably is hard to understand, especially if not knowing the native code), but just in case it helps: protected void setReceiveTimeout( long receiveTimeout ) throws CommException { // 0 timeout suppose a call to available() was made before // so receive() shall return the current available data if (receiveTimeout == 0) { port_.disableReceiveTimeout(); rs232Logger_.finest("Zero timeout, disabling receive timeout"); } else if (receiveTimeout == ConnectionTimeouts.INFINITE_MILLISECS) { port_.disableReceiveTimeout(); rs232Logger_.finest("Infinite timeout, disabling receive timeout"); } else { int intTimeout; if (receiveTimeout > Integer.MAX_VALUE) { intTimeout = Integer.MAX_VALUE; rs232Logger_.warning( "Long timeout " + receiveTimeout + " truncated to Int timeout " + intTimeout ); } else { // happy casting intTimeout = (int) receiveTimeout; } // rxtx library rx timeout precision is bad // when set to something bigger than 10 seconds! // from the log file: // port_.enableReceive Timeout(5172) // tcgetattr: VTIME:51, VMIN:0 // c_cc[VTIME] = 51, c_cc[VMIN] = 0 // ReadTotalTimeoutConstant: 5100 // .... 5100 ms later ... // size > 0: spent=5110 have=5100 // read_byte_array: // while ( 0 < 1 && 2 < 20) exp 5125 < timeout 5172 // entering serial_read(1) // now serial_read again waits 5100 ms because c_cc[VTIME] // is still 51 resulting in // size > 0: spent=5110 have=5100 // TO leaving serial_read // read_byte_array: // while ( 0 < 1 && 3 < 20) exp 10250 < timeout 5172 // RXTXPort:readArray: 1 0 // leaving RXTXPort:readArray // RXTXPort:SerialInputStream:read(1024 0 1024) returned 0 bytes // 3 14:35:12 20/Apr/07 30 (Rs232Connection doConcreteRead): // read(b, 0, 1024) = 0 // 3 14:35:12 20/Apr/07 31 (Timer getTimeSinceExpired): // Timer expired (at 14:35:07.778, now is 14:35:12.872). // Since expired = 5094 ms // ? 14:35:12 20/Apr/07 32 (Rs232Connection doConcreteRead): // Bad Rx timeout precision: // late for more than 100 ms (5094 > 100) // so internally it is stored as in tenth of seconds. // so we make it modulo 100 to avoid differences. // Update: does not work for Adrien: // size > 0: spent=9797 have=9800 // size > 0: spent=19594 have=9800 // new attempt: first divide by two :) if (true) { // tolerate whether applied twice by a bug in rxtx (win) intTimeout = intTimeout / 2; if (intTimeout > 100) { // for overhead intTimeout -= 100; } else { // < 100, use smallest possible. // 0 probably blocks, except for windows, there is // returns. intTimeout = 1; } } if (true) { intTimeout = ( intTimeout / 100 ) * 100; // 0 would disable, so let's take 100 :) if (intTimeout < 100) { intTimeout = 100; } } try { if (intTimeout != lastRxTo_) { lastRxTo_ = intTimeout; rs232Logger_.finest( "Setting serial port receive timeout : " + intTimeout + "ms" ); port_.enableReceiveTimeout(intTimeout); // verify that the driver is not lying to us if (!port_.isReceiveTimeoutEnabled()) { throw new UnsupportedCommOperationException( "Receive Timeout not enabled " + "after port_.enableReceiveTimeout()!"); } } if (ENABLE_RECEIVE_TIMEOUT_PRECISION_LOGGING) { // timer to warn if rx timeout precision is bad // see doConcreteRead function. if (timerRxTo_ == null) { timerRxTo_ = new Timer( "Rx Timeout precision Timer", intTimeout ); } else { timerRxTo_.restart(intTimeout); } } } catch (UnsupportedCommOperationException e) { rs232Logger_.finest( "chaining UnsupportedCommOperationException: " + e); throw new CommException(e, getName()); } } } just in case it helps. oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From marcopar at gmail.com Thu Oct 2 08:06:35 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 16:06:35 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <20081002113637.GB25437@elberon.bln.de.ingenico.com> References: <48D8DFA5.6090203@gmail.com> <48E49018.3050908@gmail.com> <20081002113637.GB25437@elberon.bln.de.ingenico.com> Message-ID: <48E4D56B.9090601@gmail.com> Interesting, thank you. At least is not a bug of mine. Btw i doscovered this timeout imprecision while i was waiting for a response from an Ingenico i9400 eftpos ;) From trevor at vocaro.com Thu Oct 2 09:22:18 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Thu, 2 Oct 2008 11:22:18 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > The license for commapi is not that clear on enabling those of us > that agreed to it to do what you want. If you are referring to the Sun version (http://java.sun.com/products/javacomm/ ), then I don't see how their license matters. Like I said, there is the GNU ClasspathX version, which I believe is a drop-in replacement for Sun's version, and it's under the LGPL. > classpathx could use rxtx code to do what you wish. But then ClasspathX would be locked into RXTX. I thought the idea of the Comm API was to provide a thin interface for pluggable drivers, of which RXTX would be one implementation. So, my suggestion is actually the opposite: RXTX should use the standard javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX would simply provide the declarations of this namespace to avoid the Sun licensing issues. That way, users of javax.comm could switch to a different driver without changing any code. > I think if you dig into all of the details, it isn't worth it. The > package is spoiled with Solaris specific hooks in commapi 3. Which package are you referring to? The Sun distribution of the namespace or the ClasspathX distribution? Perhaps the Sun version includes a reference implementation that is Solaris-specific, but the javax.comm namespace is platform independent, right? In that case, ClasspathX could be used. Trevor From tjarvi at qbang.org Thu Oct 2 22:33:33 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Oct 2008 22:33:33 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Thu, 2 Oct 2008, Trevor Harmon wrote: > On Oct 1, 2008, at 10:42 PM, Trent Jarvi wrote: > >> The license for commapi is not that clear on enabling those of us that >> agreed to it to do what you want. > > If you are referring to the Sun version > (http://java.sun.com/products/javacomm/), then I don't see how their license > matters. Like I said, there is the GNU ClasspathX version, which I believe is > a drop-in replacement for Sun's version, and it's under the LGPL. > >> classpathx could use rxtx code to do what you wish. > > But then ClasspathX would be locked into RXTX. I thought the idea of the Comm > API was to provide a thin interface for pluggable drivers, of which RXTX > would be one implementation. > > So, my suggestion is actually the opposite: RXTX should use the standard > javax.comm namespace instead of the non-standard gnu.io namespace. ClasspathX > would simply provide the declarations of this namespace to avoid the Sun > licensing issues. That way, users of javax.comm could switch to a different > driver without changing any code. > >> I think if you dig into all of the details, it isn't worth it. The package >> is spoiled with Solaris specific hooks in commapi 3. > > Which package are you referring to? The Sun distribution of the namespace or > the ClasspathX distribution? Perhaps the Sun version includes a reference > implementation that is Solaris-specific, but the javax.comm namespace is > platform independent, right? In that case, ClasspathX could be used. > Hi Trevor The classes on classpathx come from Kaffe which is a clean room implementation of the javax.comm wrappers. As a clean room implementation, they are not bound by the license that comes with Sun's javax.comm package. RXTX 2.0 actually does what you want for plugging into javax.comm regardless of the author. There is not very much developer interest within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. javax.comm has not gone through a java community process JSR. It isn't as 'standard' as you might think. The original package was grandfathered into the namespace but was already lacking attention. Most of us would favor a JSR and doing what you want. Bending the rules because there isn't a right solution isn't something rxtx.org will do. There is a script in the rxtx contrib directory with the source that replaces gnu.io with javax.comm (and the reverse). Switching packages is not a big deal. Don't confuse this with trying to lock people into a namespace. I would rather avoid the pain and confusion for end users. -- Trent Jarvi tjarvi at qbang.org From lfarkas at lfarkas.org Wed Oct 8 08:01:54 2008 From: lfarkas at lfarkas.org (Farkas Levente) Date: Wed, 08 Oct 2008 16:01:54 +0200 Subject: [Rxtx] version 2.1-8 in the near future? Message-ID: <48ECBD52.5030707@lfarkas.org> hi, is there any chance/plan for v 2.1-8 in the near future? imho there many updates so it'd be useful. yours. -- Levente "Si vis pacem para bellum!" From gillbates2 at gmail.com Wed Oct 8 17:42:10 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 01:42:10 +0200 Subject: [Rxtx] help about reading from serial as an integer Message-ID: Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 but when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len); I sometimes got 1 for 109 in the first line, sometimes exceptions.. I wonder anyone could help me with this. I just want to get 109. Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/4ffd5fcd/attachment-0134.html From tjarvi at qbang.org Wed Oct 8 19:05:04 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Oct 2008 19:05:04 -0600 (MDT) Subject: [Rxtx] version 2.1-8 in the near future? In-Reply-To: <48ECBD52.5030707@lfarkas.org> References: <48ECBD52.5030707@lfarkas.org> Message-ID: On Wed, 8 Oct 2008, Farkas Levente wrote: > hi, > is there any chance/plan for v 2.1-8 in the near future? > imho there many updates so it'd be useful. > yours. > > Hi Farkas I'm ramping up for the release. I expect something fairly usable in the next week or two but there may be more going in after that. I would be doing more releases but I'm really strapped for time. -- Trent Jarvi tjarvi at qbang.org From gillbates2 at gmail.com Wed Oct 8 19:29:38 2008 From: gillbates2 at gmail.com (Gill Bates) Date: Thu, 9 Oct 2008 03:29:38 +0200 Subject: [Rxtx] Help about cast the readings to an int Message-ID: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Hallo All, currenty I'm using http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port for reading data from my arduino board. I got string readings like following: 109 100 90 20 if I use System.out.println(new String(buffer,0,len)) instead of System.out.print(new String(buffer,0,len)); I got : 1 09 1 00 9 0 2 0 ... when I try to convert this to intergers so I could get in my other programs, I always got exceptions. to be exact, when I use int i=Integer.parseint(new String(buffer,0,len)); I always got exceptions I wonder anyone could help me with this. I just want to get 109 as integer in this case Regards, Gill Bates -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081009/bff78f66/attachment-0134.html From michael.erskine at ketech.com Thu Oct 9 01:51:39 2008 From: michael.erskine at ketech.com (Michael Erskine) Date: Thu, 9 Oct 2008 08:51:39 +0100 Subject: [Rxtx] Help about cast the readings to an int In-Reply-To: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> References: <862140DC-D8D9-4DA3-928E-1820D6816F37@gmail.com> Message-ID: <06BA3262D918014F9183B66425D5A8D43D1D09C2FB@no-sv-03.ketech.local> > Hallo All, > currenty I'm using > http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_seri [snip] Hi Gill, You need to buffer your data until you have the complete line prior to integer conversion. Regards, Michael Erskine. From trevor at vocaro.com Sat Oct 11 08:54:32 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Sat, 11 Oct 2008 10:54:32 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: <1162DCE6-EC19-435E-94E1-F5072925B156@vocaro.com> On Oct 3, 2008, at 12:33 AM, Trent Jarvi wrote: > RXTX 2.0 actually does what you want for plugging into javax.comm > regardless of the author. There is not very much developer interest > within rxtx to do much with it. RXTX 2.0 not lock anyone into rxtx. Right, but what about RXTX 2.1? If I want the bug fixes in 2.1, then I have to give up the javax.comm namespace, correct? Also, am I correct in thinking that 2.0 is the last RXTX release to support javax.comm, and all future versions will use gnu.io? Trevor From vinnyt at gmail.com Sat Oct 11 09:11:30 2008 From: vinnyt at gmail.com (Vincent Toms) Date: Sat, 11 Oct 2008 10:11:30 -0500 Subject: [Rxtx] deploying in an applet Message-ID: <31a31e7f0810110811h3ff4471ayf697608dddccfc24@mail.gmail.com> Hello, I am using RxTx in an applet I am building, and I read somewhere a site that documented how I could put the rxtx files in my applet jar file so that I wouldn't have to do an install on my clients computers? I am unable to find this any more? Could any one please advise me? thank you vt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081011/0c633cc7/attachment-0131.html From vorobyev.a at gmail.com Sun Oct 12 20:38:09 2008 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Mon, 13 Oct 2008 09:38:09 +0700 Subject: [Rxtx] rxtx & windows Message-ID: Good day, describe please steps how to build rxtx library for windows. I'm using cross-tools. OS Suse 11.0, java 6u7, gcc - 4.3. I would be grateful if someone will send me compiled dll of the latest source codes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/7fede1c9/attachment-0130.html From qlshwz0927 at hotmail.com Mon Oct 13 13:47:29 2008 From: qlshwz0927 at hotmail.com (chendi) Date: Mon, 13 Oct 2008 19:47:29 +0000 Subject: [Rxtx] RXTX question Message-ID: hello guys, I want to write a programm use the RXTXcomm.jar for communicat with serialport (COM1). The platform is Win2000. I use a modem connect to COM1 . below is the code:import gnu.io.*;//import javax.comm.*; import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.Enumeration;import java.util.TooManyListenersException; //import OeffnenUndSenden.serialPortEventListener; public class Winrxtx implements Runnable { /** * @param args */ public static void main(String[] args) { Runnable runnable = new Winrxtx(); new Thread(runnable).start(); System.out.println("main finished"); } CommPortIdentifier serialPortId; Enumeration enumComm; SerialPort serialPort; OutputStream outputStream; InputStream inputStream; Boolean serialPortGeoeffnet = false; int baudrate = 9600; int dataBits = SerialPort.DATABITS_8; int stopBits = SerialPort.STOPBITS_1; int parity = SerialPort.PARITY_NONE; String portName = "COM1"; public Winrxtx() { System.out.println("Constructor: serialport communication"); } public void run() { if (oeffneSerialPort(portName) != true) return; try { Thread.sleep(2000); } catch(InterruptedException e) { } schliesseSerialPort(); } boolean oeffneSerialPort(String portName) { Boolean foundPort = false; if (serialPortGeoeffnet != false) { System.out.println("Serialport already opened"); return false; } System.out.println("Open Serialport"); enumComm = CommPortIdentifier.getPortIdentifiers(); while(enumComm.hasMoreElements()) { serialPortId = (CommPortIdentifier) enumComm.nextElement(); if (portName.contentEquals(serialPortId.getName())) { foundPort = true; break; } } if (foundPort != true) { System.out.println("Serialport not found: " + portName); return false; } try { serialPort = (SerialPort) serialPortId.open("Open and Send", 3000); } catch (PortInUseException e) { System.out.println("Port in use"); } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { System.out.println("No access to output stream"); } try { inputStream = serialPort.getInputStream(); String message = "at"; outputStream.write((message + (char) 13).getBytes()); System.out.println("write message to port"); } catch (IOException e) { System.out.println("No access to input stream"); } try { serialPort.addEventListener(new serialPortEventListener()); } catch (TooManyListenersException e) { System.out.println("TooManyListenersException for Serialport"); } serialPort.notifyOnDataAvailable(true); try { serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); } catch(UnsupportedCommOperationException e) { System.out.println("Konnte Schnittstellen-Paramter nicht setzen"); } serialPortGeoeffnet = true; return true; } void schliesseSerialPort() { if ( serialPortGeoeffnet == true) { System.out.println("Close Serialport"); serialPort.close(); serialPortGeoeffnet = false; } else { System.out.println("Serialport already closed"); } } void serialPortDatenVerfuegbar() { try { byte[] data = new byte[150]; int num; while(inputStream.available() > 0) { num = inputStream.read(data, 0, data.length); System.out.println("Receive: "+ new String(data, 0, num)); } } catch (IOException e) { System.out.println("Erorr in reading receive message"); } } class serialPortEventListener implements SerialPortEventListener { public void serialEvent(SerialPortEvent event) { switch (event.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: serialPortDatenVerfuegbar(); break; case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: default: } } } }the problem is , when I write some message like "at" , i can not get the back message like "OK". It comes always toSerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in Linux. what's the problem ? Do you have any solution? thank you very much.Richard ???????????Live ?????????? ?????? ?????MSN?????????? ????? _________________________________________________________________ MSN ???????????????????? http://cn.msn.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081013/381da5a0/attachment-0129.html From trevor at vocaro.com Tue Oct 14 07:41:51 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Tue, 14 Oct 2008 09:41:51 -0400 Subject: [Rxtx] RXTX question In-Reply-To: References: Message-ID: <1C5C3021-EBB0-4624-9BF6-B055A9E1C126@vocaro.com> On Oct 13, 2008, at 3:47 PM, chendi wrote: > the problem is , when I write some message like "at" , i can not get > the back message like "OK". It comes always to > SerialPortEvent.OUTPUT_BUFFER_EMPTY: ; but this code works fine in > Linux. what's the problem ? I would begin by making sure that Sun's SimpleReader and SimpleWriter examples work with your setup: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html I believe those are known to work on Windows, so if they work for you then at least you know it's your Java code and not the driver that's the problem. Trevor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081014/df3c5d32/attachment-0128.html From aizpuru at gmail.com Wed Oct 15 20:16:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Thu, 16 Oct 2008 12:16:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) Message-ID: Hi everyone, I am developing a program which shows several tables. The tables' data comes from a device connected to the PC via RS232. The PC sends some bytes and the device answers with the data to fill the tables. The thing is that sometimes it stops listening and even if the computer keeps sending bytes and the device answering, the data is not read from the port. The reading thread does not read anything. It doesn't show any exception, so I am puzzled. Another thing is that the program seems to work on my computer, but the problems begin when I run it on my laptop. Does anyone have an idea of what's going on? Do you need I paste any code? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081016/0748030d/attachment-0127.html From marcopar at gmail.com Thu Oct 16 01:21:49 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 16 Oct 2008 09:21:49 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: Message-ID: <48F6EB8D.2090201@gmail.com> Ondiz Aizpuru wrote: > exception, so I am puzzled. Another thing is that the program seems to > work on my computer, but the problems begin when I run it on my laptop. > Does anyone have an idea of what's going on? once upon a time.... i had a problem with a laptop and a serial device. the problem was the laptop that was not providing standard voltage levels on the serial port and the device being very picky about that. another problem i had recently was related to the use of serial-usb adapters, never had problems before but this time i was experiencing random bytes corruption and even random byte generation on the serial line. From sebastien.jean.rxtx at gmail.com Thu Oct 16 05:11:50 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 13:11:50 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <48F6EB8D.2090201@gmail.com> References: <48F6EB8D.2090201@gmail.com> Message-ID: <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> > another problem i had recently was related to the use of serial-usb > adapters, never had problems before but this time i was experiencing > random bytes corruption and even random byte generation on the > serial line. I also experienced weird behaviour using prolific-based usb-serial converters under mac OS X. Baz > From sebastien.jean.rxtx at gmail.com Thu Oct 16 08:59:42 2008 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Thu, 16 Oct 2008 16:59:42 +0200 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > The Mac OS X prolific driver is horrendous. We are having better > results with FTDI and Keyspan. Yes, i noticed that. I always use ftdi-based devices now. But the very first time, it took me a lot of time to understand what was happening ! Baz From aizpuru at gmail.com Thu Oct 16 16:49:29 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 08:49:29 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: I changed the flow control to see if this solved my problem. It only improved a little bit the situation. Now the program runs for... 5sec? Do you know something else I can try? Please. I'm desperate. Thank you. Ondiz 2008/10/17 Sebastien Jean > > Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : > > > The Mac OS X prolific driver is horrendous. We are having better > > results with FTDI and Keyspan. > > > > Yes, i noticed that. I always use ftdi-based devices now. But the very > first time, it took me a lot of time to understand what was happening ! > > Baz > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/1f01613e/attachment-0126.html From tjarvi at qbang.org Thu Oct 16 19:25:18 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Oct 2008 19:25:18 -0600 (MDT) Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Just to be clear FTDI is not flow control. They are talking about problems with USB serial devices. Often there are updates for the drivers that can help. It would not be shocking to hear that a driver for some device just locks up after a while and rxtx never reads anything. If you are using a USB serial dongle on the laptop, pick up one of the recommended devices below and make sure you have the latest driver. On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > I changed the flow control to see if this solved my problem. It only > improved a little bit the situation. Now the program runs for... 5sec? Do > you know something else I can try? Please. I'm desperate. > > Thank you. > Ondiz > > 2008/10/17 Sebastien Jean > >> >> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >> >>> The Mac OS X prolific driver is horrendous. We are having better >>> results with FTDI and Keyspan. >> >> >> >> Yes, i noticed that. I always use ftdi-based devices now. But the very >> first time, it took me a lot of time to understand what was happening ! >> >> Baz >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > From aizpuru at gmail.com Thu Oct 16 20:02:20 2008 From: aizpuru at gmail.com (Ondiz Aizpuru) Date: Fri, 17 Oct 2008 12:02:20 +1000 Subject: [Rxtx] Problems reading data (sometimes) In-Reply-To: References: <48F6EB8D.2090201@gmail.com> <738644FE-6076-424A-B401-306A7CC874B0@gmail.com> <72ef860f0810160643i7261bbccne2a7dfcafa17c45e@mail.gmail.com> Message-ID: Yes I'm using a USB serial dongle, but i'm not sure if that was the problem because I tried the program on another computer and it didn't work very well. I was so desperate that I changed the library. With the sun's one it works, so after one week dealing with this... That's good enough for me. Thank you for your help. Ondiz 2008/10/17 Trent Jarvi > > Just to be clear FTDI is not flow control. They are talking about problems > with USB serial devices. Often there are updates for the drivers that can > help. It would not be shocking to hear that a driver for some device just > locks up after a while and rxtx never reads anything. > > If you are using a USB serial dongle on the laptop, pick up one of the > recommended devices below and make sure you have the latest driver. > > > On Fri, 17 Oct 2008, Ondiz Aizpuru wrote: > > I changed the flow control to see if this solved my problem. It only >> improved a little bit the situation. Now the program runs for... 5sec? Do >> you know something else I can try? Please. I'm desperate. >> >> Thank you. >> Ondiz >> >> 2008/10/17 Sebastien Jean >> >> >>> Le 16 oct. 08 ? 15:43, Fred G. Martin a ?crit : >>> >>> The Mac OS X prolific driver is horrendous. We are having better >>>> results with FTDI and Keyspan. >>>> >>> >>> >>> >>> Yes, i noticed that. I always use ftdi-based devices now. But the very >>> first time, it took me a lot of time to understand what was happening ! >>> >>> Baz >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20081017/28641407/attachment-0126.html From hakcenter at gmail.com Thu Oct 16 22:16:16 2008 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 16 Oct 2008 21:16:16 -0700 Subject: [Rxtx] OSX Woes Message-ID: <48F81190.6090406@gmail.com> Well I've spent too much time, in my own dabblings to find out that the current build of the library does not support non-standard baud rates, but please continue to read this. I've found that from OSX 10.4 and up, you can use aparently, IOSSIOSPEED to set a non standard baud rate. However I have no idea where to actually code this into the library at all, I spent about an hour playing around in xcode, with various things, and nothing seemed to really work. I did manage to get it to compile in specific areas, including the ioss.h from the framework, using IOSIOSPEED, but I don't know where to put it, to see if I can actually get a non-standard baud rate working. Any ideas? From pete.flugstad at gmail.com Mon Oct 20 12:43:42 2008 From: pete.flugstad at gmail.com (Pete Flugstad) Date: Mon, 20 Oct 2008 13:43:42 -0500 Subject: [Rxtx] problem in ParallelImp.c writeByte? Message-ID: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> I'm trying to use RXTX to talk out a parallel port under Windows, and I'm getting an exception writing a byte to the port. In looking at the code in ParallelImp.c, it looks like the if check on the return code from WriteFile is incorrect: JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, jobject jobj, jint ji ) { unsigned char byte = (unsigned char)ji; int fd = get_java_var( env, jobj,"fd","I" ); #ifdef WIN32 DWORD countWritten; /* Fixme, should be a loop until all is written */ if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; #else if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; #endif throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); WriteFile (according to http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns non-zero on success - it's unclear if that is less than zero or not, but I'd guess it's probably 1 (that's what my windef.h has in it). I'm guessing the logic here needs to be > 0 (or != 0) return code from WriteFile should return zero? (and it might want to check countWritten == 1 as well?). I checked CVS and it looks like the above code is still current. Pete From johnny.luong at trustcommerce.com Mon Oct 20 13:33:36 2008 From: johnny.luong at trustcommerce.com (Johnny Luong) Date: Mon, 20 Oct 2008 12:33:36 -0700 Subject: [Rxtx] problem in ParallelImp.c writeByte? In-Reply-To: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> References: <84d4a6d50810201143m316c588bp32862137f8b4356b@mail.gmail.com> Message-ID: <48FCDD10.9090104@trustcommerce.com> Pete Flugstad wrote: > I'm trying to use RXTX to talk out a parallel port under Windows, and > I'm getting an exception writing a byte to the port. > > In looking at the code in ParallelImp.c, it looks like the if check on > the return code from WriteFile is incorrect: > > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), > &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > WriteFile (according to > http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx) returns > non-zero on success - it's unclear if that is less than zero or not, > but I'd guess it's probably 1 (that's what my windef.h has in it). > > I'm guessing the logic here needs to be > 0 (or != 0) return code from > WriteFile should return zero? (and it might want to check > countWritten == 1 as well?). > > I checked CVS and it looks like the above code is still current. > > Pete > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > Hi, The code should probably loop (as part of its use of asynchronous io?) but maybe the attached patch will help in the meantime... Best, Johnny -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelImp.c.patch Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20081020/fbe42666/attachment-0121.pl From Noel.Goldsmith at dsto.defence.gov.au Tue Oct 21 17:41:16 2008 From: Noel.Goldsmith at dsto.defence.gov.au (Goldsmith, Noel) Date: Wed, 22 Oct 2008 10:41:16 +1100 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ Message-ID: Hi, I am using rxtx with ImageJ on a number of macs in our lab. These are mostly G5's running 10.4 (I know I am slow to adopt new stuff, but it all works very well). We have an Applescript to add a new user (add them to the uucp list for the lock files) to the list of users when we get a new user. This is for G5's and 10.4. I have now got some Intel boxes and have successfully compiled the code from CVS using the instructions, which use Xcode from some time ago, (not the most recent, which I did try but gave me some errors), which worked as advertised. I have produced a universal version and a PPC only version. The PPC version seems to work OK on the G5 running 10.5.x (although I just tested it for a short time so far). I am now installing a new dual quad core machine with lots of RAM, and thought I would run ImageJ 64 bit. Steps I followed. Installed rxtx by the dangerous method, put the universal files into the folder Library/Java/extensions. Installed the keyspan software and the 28x twin serial device and plugged the serial stage controller in. Ran imageJ with our plug-ins which do the serial talking. Ran a plug-in to use the stage. And using ImageJ it works fine. But using ImageJ64 bit I get a list of complaints. Note that ImageJ works fine until I try to use a serial port. I have 24 Gb of Ram allocated to it, and it handles it. Now I guess this is to do with something about 64 bit. If you could make any suggestions that would be good. I am happy to try stuff out and share this with the list. Thank you -- Noel Goldsmith Air Vehicles Division Defence Science and Technology Organisation 506 Lorimer Street Port Melbourne Vic 3207 Ph 03 96267527 Fax 03 96267089 Mobile 0428364003 Noel.goldsmith at dsto.defence.gov.au IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. From netbeans at gatworks.com Tue Oct 21 18:05:33 2008 From: netbeans at gatworks.com (U. George) Date: Tue, 21 Oct 2008 20:05:33 -0400 Subject: [Rxtx] MAC OSX10.5 INTEL and ImageJ In-Reply-To: References: Message-ID: <48FE6E4D.8070404@gatworks.com> Ran a plug-in to use the stage. > > And using ImageJ it works fine. > But using ImageJ64 bit I get a list of complaints. > Note that ImageJ works fine until I try to use a serial port. I have 24 Gb > of Ram allocated to it, and it handles it. > > Now I guess this is to do with something about 64 bit. > If you could make any suggestions that would be good. > I am happy to try stuff out and share this with the list. I suppose one should first ask - what are the complaints ? Is it the 24gb? From trevor at vocaro.com Wed Oct 1 14:34:38 2008 From: trevor at vocaro.com (Trevor Harmon) Date: Wed, 1 Oct 2008 16:34:38 -0400 Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? Message-ID: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Hi, There are two different versions of RXTX: 2.0 with javax.comm namespace 2.1 with gnu.io namespace I don't understand the purpose of the non-standard gnu.io namespace. Is there a reason for it? I could understand it if there were no open-source implementations of the javax.comm API, but there is one here: http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz Couldn't RXTX 2.1 just use that? Trevor From tjarvi at qbang.org Wed Oct 1 20:42:21 2008 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Oct 2008 20:42:21 -0600 (MDT) Subject: [Rxtx] Why does RXTX 2.1 not use javax.comm namespace? In-Reply-To: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> References: <3382F0AB-D56D-4D2C-AB10-BCE39C28EE8E@vocaro.com> Message-ID: On Wed, 1 Oct 2008, Trevor Harmon wrote: > Hi, > > There are two different versions of RXTX: > > 2.0 with javax.comm namespace > 2.1 with gnu.io namespace > > I don't understand the purpose of the non-standard gnu.io namespace. > Is there a reason for it? > > I could understand it if there were no open-source implementations of > the javax.comm API, but there is one here: > > http://ftp.gnu.org/gnu/classpathx/comm-20040420.tar.gz > > Couldn't RXTX 2.1 just use that? > > Trevor Hi Trevor, Well, I can explain what the intent is not.. The intent is not to cause problems for people that just want a java api to communicate with serial ports. There are some issues that make that hard. The license for commapi is not that clear on enabling those of us that agreed to it to do what you want. classpathx could use rxtx code to do what you wish. I think if you dig into all of the details, it isn't worth it. The package is spoiled with Solaris specific hooks in commapi 3. That leaves you wanting something like javax.comm but slightly different yet wanting the namespace for consistancy.... -- Trent Jarvi tjarvi at qbang.org From marcopar at gmail.com Thu Oct 2 03:10:48 2008 From: marcopar at gmail.com (marcopar at gmail.com) Date: Thu, 02 Oct 2008 11:10:48 +0200 Subject: [Rxtx] receive timeout under windows xp In-Reply-To: <48D8DFA5.6090203@gmail.com> References: <48D8DFA5.6090203@gmail.com> Message-ID: <48E49018.3050908@gmail.com> So? Is it a normal behavior? Is it a bug? Is it a known issue but can't be solved? Maybe i did something wrong? Suggestions? marcopar at gmail.com wrote: > Hi, > i'm doing some test on the receive timeout behavior under windows xp pro > and i found some odd things. > > Setting a value under 150000 everything works as expected, there's some > delay tough, the timeout triggers some seconds later. > > This imprecision can be significant, for example if set it to 170000, i > have the timeout at 180000. > But the big problem is that: > if i set a timeout of 160000 the read timeouts after about 128000 > if i set a timeout of 180000 the read timeouts after about 16000 (yes, > 16sec) > > There's no randomness in these values, everytime i have the same results. > Same behaviour can be obtained in windows server 2003. > > The same tests under Linux give results as expected with all values of > timeout and timeout triggers more precisely than on windows. > > I'm using normal serial lines. > I made the test with something connected to the line and without. > > > > Here's the test